<?php
declare (strict_types = 1);

namespace app\middleware;

use app\BaseController;
use app\Request;

class Location
{

    public function handle(Request $request, \Closure $next)
    {
        if (empty($request->header('Latitude'))||empty($request->header('Longitude'))){
            BaseController::$latitude=0;
            BaseController::$longitude=0;
        }else{
            BaseController::$latitude=(float)$request->header('Latitude');
            BaseController::$longitude=(float)$request->header('Longitude');
        }

        return $next($request);
    }
}
